<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateOpenShopLocation extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('open_shop_location', function (Blueprint $table) {
            $table->id();

            $table->unsignedInteger('mainProcessId')->default(0)->comment('开店主流程id');
            $table->string('orderNo', 60)->default('')->comment('开店订单号');
            $table->unsignedTinyInteger('step')->default(0)->comment('步骤 1：指定开发经理 2：提交选址表单 3：确认');

            $table->string('investmentManagerName', 60)->default('')->comment('招商经理名称');
            $table->unsignedInteger('investmentManagerId')->default(0)->comment('招商经理id');
            $table->unsignedInteger('assignTime')->default(0)->comment('指派开发经理时间');
            $table->string('shopLocationReportUrl')->default('')->comment('选址报告');
            $table->unsignedInteger('submitReportTime')->default(0)->comment('提交报告时间');
            $table->unsignedTinyInteger("confirmStatus")->default(0)->comment('确认状态 0 - 待确认 1 - 已确认');
            $table->unsignedInteger('confirmTime')->default(0)->comment('确认时间');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');

            $table->unique(['orderNo'], 'idx_orderNo');
            $table->unique(['mainProcessId'], 'idx_mainProcessId');

            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '开店 - 选址阶段主表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('open_shop_location');
    }
}
